package day02;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class StuTest {
    public static void main(String[] args) {
        List<Stu> list = new ArrayList<>();
        Stu stu1 = new Stu(100,"tom",21,172,55);
        Stu stu2 = new Stu(101,"tony",22,171,59);
        Stu stu3 = new Stu(102,"tod",23,170,51);
        Stu stu4 = new Stu(103,"racy",22,170,54);
        Stu stu5 = new Stu(104,"thea",21,172,58);
        Collections.addAll(list,stu1,stu2,stu3,stu4,stu5);
        list.sort(Stu::compareTo);
//       Collections.sort(list);//效果与上面的语句一样
        list.forEach(stu -> System.out.println(stu));

    }
}
